<template>
  <div class="search">
    <f-form ref="form" :action="api.orderdetail" :form-key="this.formItem.orderdetailId" >
      <f-form-item label="订单Id"  name="orderId" dataType="${formField.dataType}"   :value="formItem.orderId" />
      <f-form-item label="订单类型（1普通订单，2贵宾厅预约订单，3贵宾通道预约订单，4延误险订单， 5转卡订单,6充值订单）"  name="orderType" dataType="${formField.dataType}"   :value="formItem.orderType" />
      <f-form-item label="业务Id"  name="businessId" dataType="${formField.dataType}"   :value="formItem.businessId" />
      <f-form-item label="商品Id"  name="goodsId" dataType="${formField.dataType}"   :value="formItem.goodsId" />
      <f-form-item label="商品数量"  name="buyNum" dataType="number"   :value="formItem.buyNum" />
      <f-form-item label="单价"  name="unitPrice" dataType="${formField.dataType}"   :value="formItem.unitPrice" />
      <f-form-item label="分类码"  name="categoryCode" dataType="${formField.dataType}"   :value="formItem.categoryCode" />
      <f-form-item label=""  name="isEnd" dataType="number"   :value="formItem.isEnd" />
      <f-form-item label="过期时间"  name="expireDate" dataType="${formField.dataType}"   :value="formItem.expireDate" />
      <f-form-item label=""  name="createDate" dataType="${formField.dataType}"   :value="formItem.createDate" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'orderdetailForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          orderdetailId: '',
          orderId: '',
          orderType: '',
          businessId: '',
          goodsId: '',
          buyNum: '',
          unitPrice: '',
          categoryCode: '',
          isEnd: '',
          expireDate: '',
          createDate: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.orderdetailId) {
          let params={
              orderdetailId:data.orderdetailId
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
